import React from 'react';
import dynamic from 'dva/dynamic';
import { Route } from 'dva/router';
import { isToken } from '../utils/judgmentEquipment.js'

export default function distributionRoute(app) {
    const Distribution = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/distribution'),
    });
    const DistributionSearch = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/distributionSearch'),
    });
    const MyDistribution = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/myDistribution'),
    });
    const MyStore = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/myStore'),
    });
    const EditMyDistribution = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
                import(/* webpackChunkName: "loginModel" */'../models/orderList/orderListModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/editMyDistribution'),
    });
    const PutForward = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/putForward'),
    });
    const MyDistributionOrder = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/myDistributionOrder'),
    });
  const ReportDetail = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/reportDetail'),
    });
    const CashDetail = dynamic({
            app,
            models: () => {
                return [
                    import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
                ];
            },
            component: () => import(/* webpackChunkName: "login" */'../routes/distribution/cashDetail'),
        });
    const Report = dynamic({
            app,
            models: () => {
                return [
                    import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
                ];
            },
            component: () => import(/* webpackChunkName: "login" */'../routes/distribution/report'),
        });
    const MyTeam = dynamic({
        app,
        models: () => {
            return [
                import(/* webpackChunkName: "loginModel" */'../models/distribution/distributionModel'),
            ];
        },
        component: () => import(/* webpackChunkName: "login" */'../routes/distribution/myTeam'),
    });
    return (
        [
            <Route key="/distribution" exact path="/distribution" component={Distribution}/>,
            <Route key="/distributionSearch" exact path="/distributionSearch/:keyword" component={DistributionSearch}/>,
            <Route key="/myDistribution" exact path="/myDistribution" component={MyDistribution}/>,
            <Route key="/myStore" exact path="/myStore/:id" component={MyStore}/>,
            <Route key="/editMyDistribution" exact path="/editMyDistribution" component={EditMyDistribution}/>,
            <Route key="/putForward" exact path="/putForward" component={PutForward}/>,
            <Route key="/reportDetail" exact path="/reportDetail" component={ReportDetail}/>,
            <Route key="/cashDetail" exact path="/cashDetail" component={CashDetail}/>,
            <Route key="/report" exact path="/report" component={Report}/>,
            <Route key="/myTeam" exact path="/myTeam" component={MyTeam}/>,
            <Route key="/myDistributionOrder" exact path="/myDistributionOrder" component={MyDistributionOrder}/>,
        ]
    );
}